Skip to content

Conversation

@CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Aug 1, 2017

Integer and Floating literals are aware of their negation but
do not store the sign in the text of the value. Retrieve the
sign bit and properly interpolate the text of the literal value
with it to distinguish negative and positive literals.

Includes a bit of cleanup in IRGen too.

Integer and Floating literals are aware of their negation but
do not store the sign in the text of the value.  Retrieve the
sign bit and properly interpolate the text of the literal value
with it to distinguish negative and positive literals.
@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 1, 2017

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 1, 2017

#11288 Will unblock the bots.

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 1, 2017

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Aug 1, 2017

@swift-ci please test and merge

@swift-ci swift-ci merged commit 9328a43 into swiftlang:master Aug 1, 2017
@CodaFi CodaFi deleted the a-distinctly-negative-attitude branch August 1, 2017 21:15

APInt getValue() const;
static APInt getValue(StringRef Text, unsigned BitWidth);
static APInt getValue(StringRef Text, unsigned BitWidth, bool Negative);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you 're going to store a sign you should use APSInt.


if (intExpr->isNegative())
intValue = -intValue;
intType->getBitWidth(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember offhand but I think you need an extra bit for the negative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants